/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Random;

/**
 * <p>Project: jse2204 - Ex3
 * <p>Powered by webrx On 2022-09-05 17:15:57
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Ex3 {
    public static void main(String[] args) {

        int rows = 6;
        int cols = 20;
        Random rand = new Random();

        for (int i = 1; i <= rows; i++) {
            for (int j = 1; j <= cols; j++) {
                int n = rand.nextInt(31, 36);
                if (i == 1 || i == rows) {

                    System.out.print("\033[" + n + "m*\033[0m");
                } else {
                    if (j == 1 || j == cols) {
                        System.out.print("\033[" + n + "m*\033[0m");
                    } else {
                        System.out.print(" ");
                    }
                }
            }
            System.out.println();
        }


        for (int i = 1; i < 16; i += 2) {
            for (int j = 1; j <= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }


        for (int i = 13; i >= 1; i -= 2) {
            for (int j = 1; j <= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
